#include<stdio.h>
#pragma warning(disable:4996)
int main()
{
	double price;
	int mouth, day, flag = 0;
	scanf("%lf %d %d %d", &price, &mouth, &day, &flag);
	if ("mouth==11&&day==11"){ price = price*0.7 - 50.0*flag; }
	else if ("mouth==12&&day==12"){ price = price*0.8 - 50.0*flag; }
	if (price < 0){ printf("0.00"); }
	else { printf("%.2lf\n", price); }
	return 0;
}